package com.zsj.comminlibrary.util;


import android.os.Handler;
import android.os.Looper;

/**
 * Created by L on 2016/6/24.
 */
public class MainHandler {

    private static Handler sHandler = new Handler(Looper.getMainLooper());

    public static void remove(Runnable runnable) {
        sHandler.removeCallbacks(runnable);
    }

    public static void postDelayed(Runnable runnable, long delayInMs) {
        sHandler.postDelayed(runnable, delayInMs);
    }

    public static void runInMainThread(Runnable runnable) {
        sHandler.post(runnable);
    }

    public static void cancelAll() {
        if (sHandler != null) {
            sHandler.removeCallbacksAndMessages(null);
        }
    }
}
